package lambdademo;

import java.util.Comparator;
import java.util.PriorityQueue;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 28463
 * Date: 2022—07—24
 * Time: 9:13
 */
@FunctionalInterface
interface A{
    //抽象方法
    void test1();

    //静态方法
    public static void test4() {

    }
    //默认方法
    default void test() {

    }
}
public class Demo01 {
    public static void main(String[] args) {
        PriorityQueue<Integer> priorityQueue = new PriorityQueue<>(new Comparator<Integer>() {
            @Override
            public int compare(Integer o1, Integer o2) {
                return o2-o1;
            }
        });
    }
    //此时这里相当于一个类实现了Comparator接口  同时重写了抽象方法compare
    PriorityQueue<Integer> priorityQueue = new PriorityQueue<>((o1, o2) -> {return o2-o1;});
    PriorityQueue<Integer> priorityQueue1 = new PriorityQueue<>(((o1, o2) -> o2-o1));
}
